#hapmap=/data1/bsi/BORA_processing/devel/data_HTHGU/illumina1/MayoGAP/mayogap_emerge/raw/clean/beagle/run_beagle/beagle_mainrun/workflow/files/reference/hapmapfiles/allpopulation
hapmap=hapmap3
#hapmap=hapmap3.tped.fws.norm
newhapmap=hapmap3.tped.fws.norm_new
./plink/plink --tfile $hapmap --keep ./files/allsamples_list --maf 0.00000001 --transpose --recode --out $newhapmap
hapmap=$newhapmap
#perl perl_remove_monomorphic.pl $hapmap ./files/hapmapfiles/hapmap3_noID_nomono
#hapmap=./files/hapmapfiles/hapmap3_noID_nomono
perl perl_extract_sample_hapmap3_populations.pl ./files/ph3/TSI/samples.txt ./files/ph3/TSI/samples_names.txt $hapmap
 perl perl_extract_sample_hapmap3_populations.pl ./files/transformed_ph3/CEU/DUOS/samples.txt ./files/transformed_ph3/CEU/DUOS/samples_names.txt $hapmap
 perl perl_extract_sample_hapmap3_populations.pl ./files/transformed_ph3/CEU/TRIOS/samples.txt ./files/transformed_ph3/CEU/TRIOS/samples_names.txt $hapmap
 perl perl_extract_sample_hapmap3_populations.pl ./files/transformed_ph3/ASW/DUOS/samples.txt ./files/transformed_ph3/ASW/DUOS/samples_names.txt $hapmap
 perl perl_extract_sample_hapmap3_populations.pl ./files/transformed_ph3/ASW/TRIOS/samples.txt ./files/transformed_ph3/ASW/TRIOS/samples_names.txt $hapmap
 perl perl_extract_sample_hapmap3_populations.pl ./files/transformed_ph3/YRI/DUOS/samples.txt ./files/transformed_ph3/YRI/DUOS/samples_names.txt $hapmap
 perl perl_extract_sample_hapmap3_populations.pl ./files/transformed_ph3/YRI/TRIOS/samples.txt ./files/transformed_ph3/YRI/TRIOS/samples_names.txt $hapmap
 perl perl_extract_sample_hapmap3_populations.pl ./files/transformed_ph3/ASN/UNR/samples.txt ./files/transformed_ph3/ASN/UNR/samples_names.txt $hapmap

./plink/plink --tfile $hapmap --keep ./files/ph3/TSI/samples_names.txt --recode --transpose --out ./files/ph3/TSI/sample
./plink/plink --tfile $hapmap --keep ./files/transformed_ph3/CEU/DUOS/samples_names.txt --recode --transpose --out ./files/transformed_ph3/CEU/DUOS/sample
./plink/plink --tfile $hapmap --keep ./files/transformed_ph3/CEU/TRIOS/samples_names.txt --recode --transpose --out ./files/transformed_ph3/CEU/TRIOS/sample
./plink/plink --tfile $hapmap --keep  ./files/transformed_ph3/ASW/DUOS/samples_names.txt  --recode --transpose --out ./files/transformed_ph3/ASW/DUOS/sample
./plink/plink --tfile $hapmap --keep ./files/transformed_ph3/ASW/TRIOS/samples_names.txt --recode --transpose --out ./files/transformed_ph3/ASW/TRIOS/sample
./plink/plink --tfile $hapmap --keep ./files/transformed_ph3/YRI/DUOS/samples_names.txt --recode --transpose --out ./files/transformed_ph3/YRI/DUOS/sample
./plink/plink --tfile $hapmap --keep ./files/transformed_ph3/YRI/TRIOS/samples_names.txt --recode --transpose --out ./files/transformed_ph3/YRI/TRIOS/sample
./plink/plink --tfile $hapmap --keep ./files/transformed_ph3/ASN/UNR/samples_names.txt --recode --transpose --out ./files/transformed_ph3/ASN/UNR/sample

perl perl_convert_hapmaptped_beagle_fakeinput.pl  ./files/ph3/TSI
perl perl_convert_hapmaptped_beagle_fakeinput.pl ./files/transformed_ph3/CEU/DUOS
perl perl_convert_hapmaptped_beagle_fakeinput.pl ./files/transformed_ph3/CEU/TRIOS
perl perl_convert_hapmaptped_beagle_fakeinput.pl ./files/transformed_ph3/ASW/DUOS
perl perl_convert_hapmaptped_beagle_fakeinput.pl ./files/transformed_ph3/ASW/TRIOS
perl perl_convert_hapmaptped_beagle_fakeinput.pl ./files/transformed_ph3/YRI/DUOS
perl perl_convert_hapmaptped_beagle_fakeinput.pl ./files/transformed_ph3/YRI/TRIOS
perl perl_convert_hapmaptped_beagle_fakeinput.pl  ./files/transformed_ph3/ASN/UNR

perl perl_update_xchr_beaglefile.pl
#perl perl_create_xchr_all_pop.pl $hapmap
#mv phasedfemale.bgl.gz ././
#mv phasedmale.bgl.gz ././
#mv markers.txt.gz ././
